#include<iostream>
#include<cmath>
using namespace std;
int main(){
	int a1=0,a2=0,a3=0,a5=0,n,a,k=0,t=0;
	float a4;
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>a;
		if(a%10==0) a1+=a;
		else if(a%5==1){
			a2=a2+pow(-1,t)*a;		
			t++;
		}
		else if(a%5==2) a3++;
		else if(a%5==3){
			a4+=a;
			k++;	
		}else if(a%5==4) if(a>a5) a5=a;	
	}
	if(a1==0) cout<<"N ";
	else cout<<a1<<" ";
	if(t==0) cout<<"N ";
	else cout<<a2<<" ";
	if(a3==0) cout<<"N ";
	else cout<<a3<<" ";
	if(k==0) cout<<"N ";
	else printf("%.1f ",(float)a4/k);	
	if(a5==0) cout<<"N";
	else cout<<a5;
	return 0;
}
